package com.example.POJO;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.time.LocalDateTime;


@JsonIgnoreProperties(value={"hibernateLazyInitializer","handler","fieldHandler"})
@Data
@Entity
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Table(name = "m_blog")
public class Blog implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "userId")
    private Long userId;


    @NotBlank(message = "标题不能为空")
    @Column(name = "title")
    private String title;


    @NotBlank(message = "摘要不能为空")
    @Column(name = "description")
    private String description;


    @NotBlank(message = "内容不能为空")
    @Column(name = "content")
    private String content;


    @JsonFormat(pattern="yyyy-MM-dd")
    @Column(name = "created")
    private LocalDateTime created;


    @Column(name = "status")
    private Integer status;

}
